1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module sourceview.StyleScheme; 26 27 private import glib.Str; 28 private import glib.c.functions; 29 private import gobject.ObjectG; 30 private import sourceview.Style; 31 private import sourceview.c.functions; 32 public import sourceview.c.types; 33 34 35 /** 36 * Controls the appearance of [class@View]. 37 * 38 * #GtkSourceStyleScheme contains all the text styles to be used in 39 * [class@View] and [class@Buffer]. For instance, it contains text styles 40 * for syntax highlighting, it may contain foreground and background color for 41 * non-highlighted text, color for the line numbers, current line highlighting, 42 * bracket matching, etc. 43 * 44 * Style schemes are stored in XML files. The format of a scheme file is 45 * documented in the [style scheme reference](./style-reference.html). 46 * 47 * The two style schemes with IDs "classic" and "tango" follow more closely the 48 * GTK theme (for example for the background color). 49 */ 50 public class StyleScheme : ObjectG 51 { 52 /** the main Gtk struct */ 53 protected GtkSourceStyleScheme* gtkSourceStyleScheme; 54 55 /** Get the main Gtk struct */ 56 public GtkSourceStyleScheme* getStyleSchemeStruct(bool transferOwnership = false) 57 { 58 if (transferOwnership) 59 ownedRef = false; 60 return gtkSourceStyleScheme; 61 } 62 63 /** the main Gtk struct as a void* */ 64 protected override void* getStruct() 65 { 66 return cast(void*)gtkSourceStyleScheme; 67 } 68 69 /** 70 * Sets our main struct and passes it to the parent class. 71 */ 72 public this (GtkSourceStyleScheme* gtkSourceStyleScheme, bool ownedRef = false) 73 { 74 this.gtkSourceStyleScheme = gtkSourceStyleScheme; 75 super(cast(GObject*)gtkSourceStyleScheme, ownedRef); 76 } 77 78 79 /** */ 80 public static GType getType() 81 { 82 return gtk_source_style_scheme_get_type(); 83 } 84 85 /** 86 * Returns: a 87 * %NULL-terminated array containing the @scheme authors or %NULL if 88 * no author is specified by the style scheme. 89 */ 90 public string[] getAuthors() 91 { 92 return Str.toStringArray(gtk_source_style_scheme_get_authors(gtkSourceStyleScheme)); 93 } 94 95 /** 96 * Returns: @scheme description (if defined), or %NULL. 97 */ 98 public string getDescription() 99 { 100 return Str.toString(gtk_source_style_scheme_get_description(gtkSourceStyleScheme)); 101 } 102 103 /** 104 * Returns: @scheme file name if the scheme was created 105 * parsing a style scheme file or %NULL in the other cases. 106 */ 107 public string getFilename() 108 { 109 return Str.toString(gtk_source_style_scheme_get_filename(gtkSourceStyleScheme)); 110 } 111 112 /** 113 * Returns: @scheme id. 114 */ 115 public string getId() 116 { 117 return Str.toString(gtk_source_style_scheme_get_id(gtkSourceStyleScheme)); 118 } 119 120 /** 121 * Gets a metadata property from the style scheme. 122 * 123 * Params: 124 * name = metadata property name. 125 * 126 * Returns: value of property @name stored in 127 * the metadata of @scheme or %NULL if @scheme does not contain the 128 * specified metadata property. 129 * 130 * Since: 5.4 131 */ 132 public string getMetadata(string name) 133 { 134 return Str.toString(gtk_source_style_scheme_get_metadata(gtkSourceStyleScheme, Str.toStringz(name))); 135 } 136 137 /** 138 * Returns: @scheme name. 139 */ 140 public string getName() 141 { 142 return Str.toString(gtk_source_style_scheme_get_name(gtkSourceStyleScheme)); 143 } 144 145 /** 146 * 147 * Params: 148 * styleId = id of the style to retrieve. 149 * Returns: style which corresponds to @style_id in 150 * the @scheme, or %NULL when no style with this name found. It is owned by 151 * @scheme and may not be unref'ed. 152 */ 153 public Style getStyle(string styleId) 154 { 155 auto __p = gtk_source_style_scheme_get_style(gtkSourceStyleScheme, Str.toStringz(styleId)); 156 157 if(__p is null) 158 { 159 return null; 160 } 161 162 return ObjectG.getDObject!(Style)(cast(GtkSourceStyle*) __p); 163 } 164 }